package com.shkco.xbjcc.fallback;

import com.shkco.exception.GlobalExceptionCode;
import com.shkco.result.JSONResult;
import com.shkco.xbjcc.doc.CourseDoc;
import com.shkco.xbjcc.feign.SearchService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class SearchServiceFallbackFactory implements FallbackFactory<SearchService> {
    @Override
    public SearchService create(Throwable throwable) {
        return new SearchService() {
            @Override
            public JSONResult saveSearch(CourseDoc courseDoc) {
                return JSONResult.error(GlobalExceptionCode.ERROR);
            }

            @Override
            public JSONResult delSearch(Long id) {
                return JSONResult.error(GlobalExceptionCode.ERROR);
            }
        };
    }
}
